<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            电梯名称：<input type="text" name="elevatorName"/>
                        </li>
                        <li>
                            上报类别：
                            <select name="reportType">
                                <option value="">所有</option>
                                <option value="0">人工上报</option>
                                <option value="1">智能设备</option>
                                <option value="2">微信上报</option>
                            </select>
                        </li>
                        <!--<li class="select-time">
                            <span>派单时间：</span>
                            <input type="text" style="width: 280px" class="time-input" id="startTime" name="dispatchDate"/>
                        </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('business:elevatorRepair:edit')}]];
    var removeFlag = [[${@permission.hasPermi('business:elevatorRepair:remove')}]];
    var prefix = ctx + "business/elevatorRepair";

    $(function () {
        var options = {
            url: prefix + "/list?reviewType=1",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "电梯维修",
            search: false,
            showExport: true,
            columns: [{
                radio: true
            },
                {
                    field: 'repairId',
                    title: '维修ID',
                    visible: false
                },
                {
                    title: "序号",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'elevatorId',
                    title: '关联电梯ID',
                    visible: false
                },
                {
                    field: 'repairCode',
                    title: '维修单号',
                },
                {
                    field: 'elevatorName',
                    title: '电梯名称',
                    formatter: function (value, row, index) {
                        return addClick(value, row);
                    }
                },
                {
                    field: 'reportType',
                    title: '上报类别',
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "人工上报"
                        } else if (value == 1) {
                            return "智能设备"
                        } else if (value == 1) {
                            return "微信上报"
                        }
                    }
                },
                {
                    field: 'dispatchPeople',
                    title: '派单人'
                },
                {
                    field: 'dispatchDate',
                    title: '派单时间',
                    sortable: true
                },
                {
                    field: 'startDate',
                    title: '开始时间'
                },
                {
                    field: 'faultReason',
                    title: '故障原因'
                },
               /* {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.repairId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.repairId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
        };
        $.table.init(options);
    });

    function addClick(value, row) {
        return '<a href="javascript:void(0)" onclick="enable(\'' + row.repairId + '\')">' + value + '</a>'
    }

    function enable(repairId) {
        createMenuItem(prefix+"/elevatorRepairInfo/" + repairId, "维修信息")
    }
</script>
</body>
</html>